<html>

<head>
    <meta charset="utf-8">
    <title>新闻详情展示页面</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="css/bootstrap.css">
    <script src="js/jquery.1.12.4.min.js"></script>
    <script src="js/bootstrap.js"></script>
</head>
<style type="text/css">
    * {
        font-family: 微软雅黑;
    }
</style>

<body>
    <div class="container">
        <h3 class="page-header">新闻详情</h3>
        <div class="row">
            <div class="col-md-6">
                <div class="panel panel-warning " id="info">

                </div>
            </div>

            <div class="col-md-6">
                <div class="panel panel-danger " id="other">

                </div>
            </div>
        </div>
    </div>
</body>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script>
    window.onload = function() {
        $.ajax({
            type: "POST",
            url: "http://localhost:8080/attachment/select",
            data: {
                id: sessionStorage.getItem("newId")
            },
            dataType: "json",
            success: function(data) {
                console.log(data)

                var info = document.getElementById("info")
                var code = '<div class="panel-heading" ><h2>标题：' + data.title + '</h2></div><div class="panel-body"><p>内容：' + data.content + '</p><br><img src="' + data.path + '" /></div>'
                info.innerHTML = code

                var other = document.getElementById("other")
                var cod = '<div class="panel-heading"><h2>作者:' + data.author + '</h2></div><div class="panel-body"><div class="list-group"><a href="" class="list-group-item"><h3>发布时间</h3><p>' + data.publishTime + '</p></a></div></div>'
                other.innerHTML = cod
            },
            fail: function() {
                alert("系统繁忙")
            }
        });
    }
</script>

</html>